#define _CRT_SECURE_NO_WARNINGS 1
#include <iostream>
#include<algorithm>
using namespace std;
int main()
{
    int n;
    cin >> n;
    int num[n], dp[n];
    for (int i = 0; i < n; i++)
        cin >> num[i];
    int res = 0;
    for (int i = 0; i < n; i++)
    {
        dp[i] = 1;
        for (int j = 0; j < i; j++)
        {
            if (num[j] >= num[i])
                dp[i] = max(dp[j] + 1, dp[i]);
        }
        res = max(res, dp[i]);
    }
    cout << res << endl;
}